package com.bw.controller;

import com.bw.domain.House;
import com.bw.service.HouseService;
import com.bw.utils.Result;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class HouseController {
    @Autowired
    HouseService houseService;
    @RequestMapping("list")
    public Result list(@RequestBody House house,Integer pageNum,Integer pageSize){
        PageHelper.startPage(pageNum, pageSize);
        List<House> list = houseService.listAll(house);
        return Result.success(new PageInfo<>(list));
    }
}
